# returns return statistics of weekdays
# unfinished !
weekdayStats <- function (TS) {
  TS1 <- cbind(TS, as.POSIXlt(index(TS))$wday, ROC(Cl(TS)), log(Cl(TS)/Op(TS)))
  colnames(TS1) <- c(colnames(TS), "wday", "ccret", "ocret")
  # remove first row as it contains NA in row ccret
  TS1 <- TS1[2:dim(TS1)[1]]
  ccreturns <- list()
  ocreturns <- list()
  
  for (wday in 1:7) {
    DTS <- TS1[TS1[,"wday"]==wday]
    if (length(DTS) > 0) {
      ccreturns[[wday]] <- as.vector(DTS[,"ccret"])
      ocreturns[[wday]] <- as.vector(DTS[,"ocret"])      
    }
  }
  return (ocreturns)
}